package com.lx.oms.controller.manager.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.utils.Utils;
import com.lx.oms.controller.dao.AccountLogMapper;
import com.lx.oms.controller.entity.AccountLogEntity;
import com.lx.oms.controller.manager.AccountLogManager;

/**
 * 账户余额日志
 *
 * @author houzhong
 * @date 2018年10月30日 下午2:03:26
 */
@Component("accountLogManager")
public class AccountLogManagerImpl implements AccountLogManager {

	@Autowired
	private AccountLogMapper accountLogMapper;
	

	@Override
	public List<AccountLogEntity> listAccountLog(Page<AccountLogEntity> page, Query search) {
		return accountLogMapper.listForPage(page, search);
	}

	@Override
	public int saveAccountLog(AccountLogEntity accountLog) {
		if (accountLog.getId() == null) {
			accountLog.setId(Utils.id().toString());
		}
		return accountLogMapper.save(accountLog);
	}

	@Override
	public AccountLogEntity getAccountLogById(BigInteger id) {
		AccountLogEntity tAccountLog = accountLogMapper.getObjectById(id);
		return tAccountLog;
	}

	@Override
	public int updateAccountLog(AccountLogEntity tAccountLog) {
		return accountLogMapper.update(tAccountLog);
	}

	@Override
	public int batchRemove(String[] id) {
		int count = accountLogMapper.batchRemove(id);
		return count;
	}
	
}
